#ifndef _PLAYER_H_
#define _PLAYER_H_

#include "YoghurtGum.h"
#include "Bullet.h"

using namespace YoghurtGum;

class Player : public Object
{

public:

	Player()
	{
		m_Sprite = Assets::GetSprite("ship");
		m_X = Device::GetWidth() / 2;
		m_Y = Device::GetHeight() - 32;
		m_Fire = 0;
	}

	Player(int a_X, int a_Y)
	{
		m_Sprite = Assets::GetSprite("ship");
		m_X = a_X;
		m_Y = a_Y;
		m_Fire = 0;
	}

	void Update()
	{
		if (Keyboard::Pressed(YGK_LEFT)) { m_X--; }
		if (Keyboard::Pressed(YGK_RIGHT)) { m_X++; }
		m_Sprite->Draw(m_X, m_Y);

		m_Fire++;
		if (m_Fire >= 25 && Keyboard::Pressed(YGK_UP))
		{
			m_Fire = 0;	

			Engine::game->current->AddObject(new Bullet(m_X + 10, m_Y));
		}
	}

	int m_Fire;
	
}; // class Player

#endif